﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ActiproSoftware.Text.Languages.DotNet.Reflection;
using System.Collections.Generic;
using AbstraX.ClientInterfaces;

namespace AbstraX.CodeElements
{
	public class Namespace : INamespaceDefinition
	{
        private string name;
        private NamespaceDefinitionCollection namespaces;
        protected IEnumerable<IElement> elements;

        public Namespace(string name)
        {
            this.name = name;
        }

        public INamespaceDefinitionCollection Children
        {
            get
            {
                var namespaces = new NamespaceDefinitionCollection();
                var lookup = new Dictionary<string, Namespace>();

                foreach (IElement element in elements)
                {
                    Namespace _namespace = new Namespace(element.FolderKeyPair);

                    if (lookup.ContainsKey(element.FolderKeyPair))
                    {
                        _namespace = lookup[element.FolderKeyPair];
                    }
                    else
                    {
                        _namespace = new Namespace(element.FolderKeyPair);
                        lookup.Add(_namespace.FullName, _namespace);
                    }

                    //_namespace.Types.Add(new 
                }

                return namespaces;
            }
        }

        public ITypeMemberDefinitionCollection ExtensionMethods
        {
            get
            {
                throw new NotImplementedException();
            }
        }

        public string FullName
        {
            get
            {
                return "global";
            }
        }

        public ITypeDefinitionCollection StandardModules
        {
            get
            {
                throw new NotImplementedException();
            }
        }

        public string ToTreeString(int indentLevel)
        {
            throw new NotImplementedException();
        }

        public ITypeDefinitionCollection Types
        {
            get
            {
                throw new NotImplementedException();
            }
        }

        public string Name
        {
            get
            {
                return name;
            }
        }
    }
}
